package sigeco.view.menu;

import java.beans.IntrospectionException;

import java.util.List;

import oracle.adf.view.faces.model.MenuModel;
import oracle.adf.view.faces.model.ProcessMenuModel;
import oracle.adf.view.faces.model.ViewIdPropertyMenuModel;

public class ProcessMenuModelAdapter {
    private String _propertyName = null;
    private Object _instance = null;
    private transient MenuModel _model = null;
    public ProcessMenuModelAdapter() {
    }
    
    public MenuModel getModel() throws IntrospectionException {
        if (_model == null) {
            ProcessMenuModel model = new ProcessMenuModel(getInstance(), getViewIdProperty());
            _model = model;
        }
        return _model;
    }
    
    public String getViewIdProperty() {
        return _propertyName;
    }
    
    /**
    * Sets the property to use to get at view id
    * @param propertyName
    */
    public void setViewIdProperty(String propertyName) {
        _propertyName = propertyName;
        _model = null;
    }
    
    public Object getInstance() {
        return _instance;
    }
    
    /**
    * Sets the treeModel
    * @param instance must be something that can be converted into a TreeModel
    */
    public void setInstance(Object instance) {
        _instance = instance;
        _model = null;
    }
}
